<script type="text/javascript">
    $(document).ready(function() {
        $('.ui .item').on('click', function() {
            $('.ui .item').removeClass('active');
            $(this).addClass('active');
        });
        $('.ui.dropdown').dropdown({
            on: 'hover'
        });
    });
    
    function reload() {
        location.reload();
    }
    
    function navigate(url) {
        window.location = url;
    }
    
    function show_popup() {
        $('#add-edit-popup').show();
    }
    
    function show_add_popup(action) {
        var number = $('#txt_entry_number').val();
        if (number <= 0) {
            number = 1;
        }
        $.ajax({
            type: "POST",
            url: "<?php echo LINK_ROOT . DIR_AJAX; ?>"+action+".php",
            data: "number=" + number,
            success: function (result) {
                $("#adds").html(result);
            }
        });
        hide_popup();
    }
    
    function paid(booking_id) {
        $("input[name='hidd_paid_id']").val(booking_id);
        $("#form_paid").submit();
    }
    
    function hide_popup() {
        $('#add-edit-popup').hide();
    }
    
    function submit_add_data() {
        var action_input = $("#form_add_data :input[name='Action']");
        action_input.val($('#action-add-button').text());
        $("#form_add_data").submit();
    }
    
    function search_booking_code() {
        $("#form_search_booking_code").submit();
    }
    
    function submit_data() {
        var action_input = $("#form_data :input[name='Action']");
        action_input.val($('#action-button').text());
        $("#form_data").submit();
    }
    
    function confirmDelete(id) {
        if (confirm('Are you sure?')) {
            $('#form_delete input[name="hidd_delete_id"]').val(id);
            $("#form_delete").submit();
        } else {
            return false;
        }
    }
    
</script>